package com.shanxia.codec.enums;

import java.util.Objects;

public enum BatteryGroupConnectorStatusEnum {

    NORMAL(0x00, "正常"),
    NOT_NORMAL(0x01, "不正常"),
    UNTRUSTED(0x10, "不可信状态"),
    UNKNOWN(99, "未知");

    public static BatteryGroupConnectorStatusEnum getByCode(int code) {
        for (BatteryGroupConnectorStatusEnum enums : BatteryGroupConnectorStatusEnum.values()) {
            if (Objects.equals(enums.code, code)) {
                return enums;
            }
        }
        return BatteryGroupConnectorStatusEnum.UNKNOWN;
    }

    BatteryGroupConnectorStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int code;
    public String name;
}